﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ColdStorage.DOL
{
    [Serializable]
    public class InternalLoad
    {     
        #region Internal Room Attributes
        double dbpeopleNumber;

        public double dbPeopleNumber
        {
            get { return dbpeopleNumber; }
            set { dbpeopleNumber = value; }
        }
        double dbengineCapacity;

        public double dbEngineCapacity
        {
            get { return dbengineCapacity; }
            set { dbengineCapacity = value; }
        }
        double dbenginePerformance;

        public double dbEnginePerformance
        {
            get { return dbenginePerformance; }
            set { dbenginePerformance = value; }
        }
        double dbventilateMultiplecycle;

        public double dbVentilateMultiplecycle
        {
            get { return dbventilateMultiplecycle; }
            set { dbventilateMultiplecycle = value; }
        }
        double dbairDensity;

        public double dbAirDensity
        {
            get { return dbairDensity; }
            set { dbairDensity = value; }
        }

        double dbairEnthalpyOutside;

        public double dbAirEnthalpyOutside
        {
            get { return dbairEnthalpyOutside; }
            set { dbairEnthalpyOutside = value; }
        }
        double dbairEnthalpyInside;

        public double dbAirEnthalpyInside
        {
            get { return dbairEnthalpyInside; }
            set { dbairEnthalpyInside = value; }
        }
        double dblightHeat;

        public double dbLightHeat
        {
            get { return dblightHeat; }
            set { dblightHeat = value; }
        }
        double dbdoorHeatFlowOpening;

        public double dbDoorHeatFlowOpening
        {
            get { return dbdoorHeatFlowOpening; }
            set { dbdoorHeatFlowOpening = value; }
        }
        double dbrespirationHeatFlowInput;

        public double dbRespirationHeatFlowInput
        {
            get { return dbrespirationHeatFlowInput; }
            set { dbrespirationHeatFlowInput = value; }
        }
        double dbrespirationHeatFlowStorage;

        public double dbRespirationHeatFlowStorage
        {
            get { return dbrespirationHeatFlowStorage; }
            set { dbrespirationHeatFlowStorage = value; }
        }
        #endregion
        


        //Tính nhiệt do người tỏa ra
        public double CalculatePeopleHeat()
        {
            return 350 * dbpeopleNumber;
        }

        //Tính nhiệt do máy vận hành
        public double CalculateEngineHeat()
        {
            if (dbenginePerformance == 0)
            {
                return 1000 * dbengineCapacity;
            }
            else{
                return 1000 * dbengineCapacity * (dbenginePerformance/100);
            }
            
        }

        //Tính nhiệt do Chiếu sáng buồng

        public double CalculateLightingHeat(double dbroomArea)
        {
            return dbroomArea * dbLightHeat;
        }

        //Tính dòng nhiệt do mở cửa
        public double CalculateDoorOpening(double dbroomArea)
        {
            return dbroomArea * dbDoorHeatFlowOpening;
        }
    
        //Tính nhiệt do thông gió buồng lạnh
        public double CalculateVentialte(double dbroomVolume)
        {
            return ((dbroomVolume * dbventilateMultiplecycle * dbairDensity) / (86400)) * (dbairEnthalpyOutside - dbairEnthalpyInside);           
        }

        // Tính dòng nhiệt do sản phẩm hô hấp
        public double CalculateFruitRespiration(double dbroomCapacity)
        {
            return dbroomCapacity * (0.1 * dbrespirationHeatFlowInput + 0.9 * dbrespirationHeatFlowStorage);
        }

    }
}
